<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">甲方标签库</ui:define>
    <ui:define name="content">
        <h:form id="productInfoForm" enctype="multipart/form-data">
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{loanProductInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{loanProductInfoBean.isView() and security:areAllGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_EDIT')}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         actionListener="#{loanProductInfoBean.onSave}"
                                         rendered="#{loanProductInfoBean.isNotView() and security:areAnyGranted('LOAN_FAMILY_TAGS_FIRST_PARTY_EDIT,LOAN_FAMILY_TAGS_FIRST_PARTY_ADD')}"
                                         update="@form"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{loanProductInfoBean.changeStatusToView}"
                                         rendered="#{loanProductInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                        <p:commandButton value="复制" icon="fa fa-copy"
                                         actionListener="#{loanProductInfoBean.onCopyProduct()}"
                                         rendered="#{loanProductInfoBean.isView()}"
                                         process="@this"
                                         update="@form"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12">
                    <div class="card">
                        <p:tabView id="tabView" scrollable="true">
                            <p:ajax event="tabChange" update="prepayOffLine" listener="#{loanProductInfoBean.onChangeTab}"/>
                            <p:tab title="信息配置">
                                <ui:include src="main-info.xhtml"/>
                            </p:tab>
                            <p:tab title="上线配置">
                                <ui:include src="loan-space.xhtml"/>
                            </p:tab>
                            <p:tab title="商务充值">
                                <ui:include src="business-recharge.xhtml"/>
                            </p:tab>
                        </p:tabView>
                    </div>
                </div>
            </div>
            <p:dialog  widgetVar="recharge-model" header="充值" modal="true" closable="true" resizable="true" style="position: absolute;">
                <p:outputPanel id="recharge-model">
                    <div class="ui-g ui-fluid card" style="width:500px;">
                        <div class="ui-g-2">
                            <p:outputLabel value="充值金额"/>
                        </div>
                        <div class="ui-g-10">
                            <p:inputNumber id="amount" value="#{loanProductInfoBean.newRecharge.amount}"/>
                        </div>
                        <div class="ui-g-2">
                            <p:outputLabel value="备注"/>
                        </div>
                        <div class="ui-g-10">
                            <p:inputText id="content" value="#{loanProductInfoBean.newRecharge.remark}"/>
                        </div>
                        <div class="ui-g-12">
                            <p:commandButton value="确定" style="float: right"
                                             actionListener="#{loanProductInfoBean.onSaveRecharge()}"
                                             process="@form"/>
                        </div>

                    </div>
                </p:outputPanel>
            </p:dialog>
        </h:form>
    </ui:define>
</ui:composition>